package git

import (
	"context"
	"io"
	"os/exec"
)

func MergeBase(ctx context.Context, stdout io.Writer, stderr io.Writer, flags []string, commits ...string) error {
	args := []string{"merge-base"}
	args = append(args, flags...)
	args = append(args, commits...)
	cmd := exec.Command("git", args...)
	cmd.Stdout = stdout
	cmd.Stderr = stderr
	err := cmd.Run()
	return err
}
